{% extends 'template.html' %}

{% block username %}
    {{ request.user.username }}
{% endblock %}

{% block content %}
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">合服计划</h1>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <button class="btn btn-success" data-text="确定发送选中的任务吗? 0个" type="button" id="bt-merge">批量合服</button>
                        <button class="btn btn-danger" data-text="确定发送选中的任务吗? 0个" type="button" id="bt-mergecallback">批量回滚</button>
                    </div>
                    <div class="panel-body">
                        <div class="col-sm-2">
                            <label>选择项目</label>
                            <select id="filter_project" style="width: 100%">
                                <option value="0" selected>全部</option>
                                {% for p in all_project %}
                                    <option value="{{ p.id }}">{{ p.project_name }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-sm-2">
                            <label>选择机房</label>
                            <select id="filter_room" style="width: 100%">
                                <option value="0" selected>全部</option>
                                {% for r in all_room %}
                                    <option value="{{ r.id }}">{{ r.text }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-sm-2">
                            <label>状态</label>
                            <select id="filter_status" style="width: 100%">
                                <option value="100" selected>全部</option>
                                {% for s in status %}
                                    <option value="{{ s.0 }}">{{ s.1 }}</option>
                                {% endfor %}
                            </select>
                        </div>
                        <div class="col-sm-2">
                            <label>主服</label>
                            <input class="form-control column_filter" id="filter_main_srv">
                        </div>
                        <div class="col-sm-2">
                            <label>从服</label>
                            <input class="form-control column_filter" id="filter_slave_srv">
                        </div>
                        <div class="col-sm-2">
                            <label>组ID</label>
                            <input class="form-control column_filter" id="filter_group_id">
                        </div>
                        <br/><br/><br/><br/><br/><br/>
                        <table id="mytable" class="display" width="100%" cellspacing="0">
                            <thead>
                            <tr>
                                <th class="center sorting_disabled">
                                    <label class="pos-rel">
                                        <input id='chb-all' type="checkbox"/>
                                    </label>
                                </th>
                                <th>id</th>
                                <th>uuid</th>
                                <th>项目</th>
                                <th>机房</th>
                                <th>主服-web区服id</th>
                                <th>从服-web区服id</th>
                                <th>组ID</th>
                                <th>合服时间</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 管理员标志-->
    <div id="is_superuser" data-is-superuser="{{ request.user.is_superuser }}"></div>

    <!-- 编辑modal-->
    <div class="modal fade" id="myModal" tabindex="" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel"></h4>
                </div>
                <div class="modal-body">
                    <input style="display: none" id="id_edit">
                    <div class="alert alert-danger alert-dismissable" id="modal-notify">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                        <label id='lb-msg'></label>
                    </div>
                    <div class="form-group row">
                        <label class="col-sm-3 control-label">状态</label>
                        <div class="col-sm-8">
                            <select id="edit_status" class="form-control" style="width: 100%">
                                {% for s in status %}
                                    <option value="{{ s.0 }}">{{ s.1 }}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button id='bt-save' type="button" class="btn btn-primary">保存</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->

{% endblock %}
{% block bodyjs %}
    {{ django_context_varable }}
    {% verbatim %}
    <script id="tpl" type="text/x-handlebars-template">
        {{#each func}}
        <button type="button" class="btn btn-{{this.type}} btn-sm" onclick="{{this.fn}}">{{this.name}}</button>
        {{/each}}
    </script>
    {% endverbatim %}
    <script src="/static/js/handlebars-v3.0.1.js"></script>
    <script src="/static/js/jquery.dataTables.js"></script>
    <script src="/static/js/zh.js"></script>
    <script src="/static/js/game_server_merge_list.js?v=20190829001"></script>
{% endblock %}
{% block css %}
    <link href="/static/css/jquery.dataTables.css" rel="stylesheet" type="text/css">
    <link href="/static/css/select2-bootstrap.css" rel="stylesheet" type="text/css">
{% endblock %}
